package eddy.yang.server;

import java.awt.Graphics;
import java.awt.Image;
import java.io.IOException;
import java.net.URL;

import javax.imageio.ImageIO;
import javax.swing.JButton;

import eddy.yang.ChessResources;

public class MyTurnButton extends JButton {
	/**
	 * 
	 */
	private static final long serialVersionUID = 3686013708424079877L;
	Image imggo;
	Image imgwait;
	Image img;
	int width;
	int height;

	public MyTurnButton() {
		URL url = ChessResources.class.getResource("Resources/go.gif");
		try {
			imggo = ImageIO.read(url);
			url = ChessResources.class.getResource("Resources/wait.gif");
			imgwait = ImageIO.read(url);
			img = imggo;
			width = imggo.getWidth(null);
			height = imggo.getHeight(null);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public void paint(Graphics g) {
		g.drawImage(img, 0, 0, null);
	}

	public void setgo() {
		img = imggo;
		repaint();
	}

	public void setwait() {
		img = imgwait;
		repaint();
	}

}
